﻿@model Apps.Models.Sys.SysModuleOperateModel
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Web.Core;
@using Apps.Locale;
@{
    ViewBag.Title = "创建";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;
}

<script type="text/javascript">
    $(function () {
    $("#btnSave").click(function () {
        if ($("form").valid()) {
            $.ajax({
                url: "@Url.Action("CreateOpt")",
                type: "Post",
                data: $("form").serialize(),
                dataType: "json",
                success: function (data) {
                    if (data.type == 1) {
                        window.parent.frameReturnByMes(data.message);
                        window.parent.frameReturnByReloadOpt(true);
                        window.parent.frameReturnByClose()
                    }
                    else {
                        window.parent.frameReturnByMes(data.message);
                    }
                }
            });
        }
        return false;
    });
    $("#btnReturn").click(function () {
        window.parent.frameReturnByClose();
    });
    });
</script>
<div class="mvctool bgb">
@Html.ToolButton("btnSave", "fa fa-save", Resource.Save,ref perm, "Save", true)
@Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply, false)
</div>
@using (Html.BeginForm())
{
             @Html.HiddenFor(model => model.Id)
 <table class="formtable">
    <tbody>
        <tr>
            <th>
                @Html.LabelFor(model => model.Name)：
           </th>
          <td>
                @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)</td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.KeyCode)：
            </th>
          <td>
                @Html.EditorFor(model => model.KeyCode)
            @Html.ValidationMessageFor(model => model.KeyCode)</td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.ModuleId)：
           </th>
          <td>
                @Html.TextBoxFor(model => model.ModuleId, new { @readOnly = "readOnly" })
            @Html.ValidationMessageFor(model => model.ModuleId)</td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.IsValid)：
         </th>
          <td>
              @Html.SwitchButtonByEdit("IsValid", true)
            @Html.ValidationMessageFor(model => model.IsValid)</td>
        </tr>
        <tr>
            <th>
                @Html.LabelFor(model => model.Sort)：
          </th>
          <td>
                @Html.EditorFor(model => model.Sort)
            @Html.ValidationMessageFor(model => model.Sort)</td>
        </tr>
    </tbody>
</table>
}
